﻿// 功能：
// 描述：
// 作者：温伟鹏
// 日期：2010/10/15 14:18:25

using System;
using MeizuSDK.Presentation;
using MeizuSDK.Core;
using System.IO;
using MeizuSDK.Presentation.Integration;
using System.Drawing;

namespace Demo
{
    class WinFormControlDemoWindow : DemoWindowBase
    {
        private ControlHost controlHost;

        public WinFormControlDemoWindow()
        {

        }

        protected override void OnLoad(EventArgs e)
        {
            controlHost = new ControlHost();
            controlHost.Size = new System.Drawing.Size(400, 600);
            controlHost.Location = new System.Drawing.Point(50, 50);

            System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();
            //panel.Dock = System.Windows.Forms.DockStyle.Fill;
            panel.Size = new Size(400, 500);
            panel.BackColor = Color.Yellow;

            System.Windows.Forms.Button button = new System.Windows.Forms.Button();
            button.Dock = System.Windows.Forms.DockStyle.Top;
            button.Size = new Size(200, 80);
            button.Text = "俺是WinForm按钮";
            button.Click += new EventHandler(button_Click);
            panel.Controls.Add(button);

            System.Windows.Forms.Button button2 = new System.Windows.Forms.Button();
            button2.Dock = System.Windows.Forms.DockStyle.Top;
            button2.Size = new Size(200, 80);
            button2.Text = "文件选择框";
            button2.Click += new EventHandler(button2_Click);
            panel.Controls.Add(button2);

            System.Windows.Forms.TextBox text = new System.Windows.Forms.TextBox();
            text.Multiline = true;
            text.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            text.Text = "我是WinForm文本框";
            text.Size = new Size(300, 200);
            text.Location = new Point(50, 200);
            panel.Controls.Add(text);

            controlHost.Child = panel;

            this.Controls.Add(controlHost);

            base.OnLoad(e);
        }

        void button2_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.ShowDialog();
        }

        void button_Click(object sender, EventArgs e)
        {
            MessageBox.Show("俺是Winform按钮", "Winform控件");
        }
    }
}
